<!DOCTYPE html>
<html>
  <head>
    <title>Home</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="" />
    <script type="application/x-javascript">
      addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); }
    </script>
    <!-- Bootstrap Core CSS -->
    <link href="/themes/1/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <!-- Custom CSS -->
    <link href="/themes/1/css/style.css" rel="stylesheet" type="text/css" />
    <!-- font CSS -->
    <!-- font-awesome icons -->
    <link href="/themes/1/css/font-awesome.css" rel="stylesheet" />
    <!-- //font-awesome icons -->
    <!-- js-->
    <script src="/themes/1/js/jquery-1.11.1.min.js"></script>
    <script src="/themes/1/js/modernizr.custom.js"></script>
    <!--webfonts-->
    <link
      href="https://fonts.googleapis.com/css?family=Roboto+Condensed:400,300,300italic,400italic,700,700italic"
      rel="stylesheet"
      type="text/css"
    />
    <!--//webfonts-->
    <!--animate-->
    <link
      href="/themes/1/css/animate.css"
      rel="stylesheet"
      type="text/css"
      media="all"
    />
    <script src="/themes/1/js/wow.min.js"></script>
    <script>
      new WOW().init();
    </script>
    <!--//end-animate-->
    <!-- chart -->
    <script src="/themes/1/js/Chart.js"></script>
    <!-- //chart -->
    <!--Calender-->
    <link rel="stylesheet" href="/themes/1/css/clndr.css" type="text/css" />
    <script
      src="/themes/1/js/underscore-min.js"
      type="text/javascript"
    ></script>
    <script src="/themes/1/js/moment-2.2.1.js" type="text/javascript"></script>
    <script src="/themes/1/js/clndr.js" type="text/javascript"></script>
    <script src="/themes/1/js/site.js" type="text/javascript"></script>
    <!--End Calender-->
    <!-- Metis Menu -->
    <script src="/themes/1/js/metisMenu.min.js"></script>
    <script src="/themes/1/js/custom.js"></script>
    <link href="/themes/1/css/custom.css" rel="stylesheet" />
    <!--//Metis Menu -->
  </head>
  <body class="cbp-spmenu-push">
    <div class="form-grids row widget-shadow">
      <div class="form-title">
        <h4>新增表单控件:</h4>
      </div>
      <div class="form-body">
        <form id="formConfigWidget">
          <div class="form-group">
            <label for="exampleInputPassword1">所属表单</label>
            <input type="password" class="form-control" />
          </div>
          <div class="form-group">
            <label for="exampleInputPassword1">控件label</label>
            <input type="password" class="form-control" />
          </div>
          <div class="form-group">
            <label for="exampleInputPassword1">控件name</label>
            <input type="password" class="form-control" />
          </div>
          <div class="form-group">
            <label for="exampleInputPassword1">控件类型</label>
            <input type="password" class="form-control" />
          </div>
          <div class="form-group">
            <label for="dictSet" class="form-label">字典控件</label>
            <select name="dictSet" class="form-control">
              <% for(let i = 0; i < data.entity.length; i++) {%>
              <option value="<%=data.entity[i]._id %>">
                <%= data.entity[i].name %>
              </option>
              <% } %>
            </select>
          </div>
          <button type="submit" class="btn btn-default">返回</button>
          <button type="submit" class="btn btn-primary" onclick="saveForm">
            添加
          </button>
        </form>
      </div>
    </div>
  </body>

  <script>
    function getFormValues(formId) {
      const form = document.getElementById(formId);
      const elements = form.elements;
      const formData = {};

      for (let i = 0; i < elements.length; i++) {
        const field = elements[i];
        const name = field.name;
        const value = field.value;

        if (name && field.nodeName !== "BUTTON") {
          formData[name] = value;
        }
      }

      return formData;
    }

    function saveForm() {
      const values = getFormValues("formConfigWidget");
      console.log(values);
    }
  </script>
</html>
